<?php

namespace App\Transformers\DailyRecord;

use App\Models\DailyRecordModel;
use League\Fractal\TransformerAbstract;

class ShowTransformer extends TransformerAbstract
{
    public function transform(DailyRecordModel $dailyRecord) {
        return [
            'user_id'    => $dailyRecord->user_id,
            'code'       => $dailyRecord->code,
            'record_type'=> $dailyRecord->record_type,
            'record_status'=>$dailyRecord->record_status,
            'username'   => handleOne($dailyRecord->user, 'username'),
            'review_user'=> handleOne($dailyRecord->userReview, 'username'),
            'begin_time' => $dailyRecord->begin_time,
            'end_time'   => $dailyRecord->end_time,
            'apply_reason'=> $dailyRecord->apply_reason,
            'rejected_reason'=> $dailyRecord->rejected_reason,
            'consume_price' => $dailyRecord->consume_price,
            'remark'     => $dailyRecord->remark,
        ];
    }

}